<template>
  <div class="student-item" v-if="studentInfo">
    <div class="student-info">
      <avatar
        :size="50"
        class="avatar"
        :src="studentInfo.pic"
      />
      <div class="student-name">{{ studentInfo.name }}</div>
      <n-icon size="24">
        <ChevronForwardOutline />
      </n-icon>
    </div>
    <div class="score-wrap">
      <div class="wrap-left">
        <div class="num">{{ wordNum.complete }}/{{ wordNum.total }}</div>
        <div class="text">完成率</div>
        <ExpressionEmoji :icon="scoreIcon" class="score-img"  :is-big="true" />
        <div class="text">综合表现</div>
      </div>
      <div class="wrap-right">
        <studentRadar :list-data="radarData" :averageScore="averageScore" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { ChevronForwardOutline } from '@vicons/ionicons5';
  import studentRadar from './radar.vue';
  import * as constants from '@/config/constants';
  import {computed, onMounted, onUnmounted} from 'vue';
  import ExpressionEmoji from "@/views/components/ExpressionEmoji/index.vue";

  const props = defineProps({
    index: {
      type: Number,
      default: 1,
    },
    studentInfo: {
      type: Object,
      default: null,
    },
    scoreIcon: {
      type: String,
      default: 'icon',
    },
    averageScore: {
      type: Number,
      default: 0,
    },
    radarData: {
      type: Object,
      default: [0,0,0,0,0,0],
    },
    wordNum: {
      type: Object,
      default: {
        complete: 0,
        total: 0,
      },
    },
  });
</script>

<style scoped lang="less">
  .student-item {
    width: 495px;
    height: 360px;
    border: 2px solid #e6eaed;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    margin-bottom: 18px;
    background-color: #fff;
    .student-info {
      display: flex;
      align-items: center;
      .student-name {
        font-size: 24px;
        margin: 0 12px;
        flex: 1;
      }
    }
    .score-wrap {
      margin-top: 24px;
      width: 100%;
      height: 240px;
      border-radius: 12px;
      background-color: #f6f8f9;
      display: flex;
      padding: 18px 0;
      .wrap-left {
        width: 132px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        border-right: 1px solid #e6eaed;
        .num {
          font-size: 28px;
          color: #1e232b;
        }
        .text {
          font-size: 18px;
          color: #9ba2aa;
        }
        .score-img {
          width: 40px;
          height: 40px;
          margin: 16px 4px;
        }
      }
      .wrap-right {
        flex: 1;
        height: 100%;
      }
    }
  }
</style>
